/****************个人信息分享栏的自适应******************/
/*自适应屏幕*/
let adjustPersonInfo = function () {
    let nodeArr = [document.querySelectorAll(".cont")[0],document.querySelectorAll(".cont")[1]],
        dynamicShare = getClass("dynamic-share")[0],
        width,
        length;
    if (dynamicShare.clientWidth > 600) {
        width = (dynamicShare.clientWidth - 24 - 17) / 2;
        length = 2;
    } else {
        width = dynamicShare.clientWidth - 17;
        length = 1;
    }
    for (let i = 0; i < nodeArr.length; i++) {
        if (length === 2 && i === 0) {
            nodeArr[i].style.margin = "0 12px 20px 0";
        } else if (length === 2 && i === 1) {
            nodeArr[i].style.margin = "0 0 20px 12px";
        } else {
            nodeArr[i].style.margin = "0 0 20px 0"
        }
        nodeArr[i].style.width = width + "px";
    }
    return length;
};
//设置字体
let setFontSize = function (playNodeList) {
    let nodeArr = playNodeList;
    for (let i = 0; i < nodeArr.length; i++) {
        nodeArr[i].style.fontSize = "14px";
        nodeArr[i].style.padding = "0";
    }
};


/**********************主函数***********************/
let initRun=function () {
    //左边菜单栏
    FadeModelShowToWindow.init("resize");
    //页面数据请求
    let url = "/share/getPublicList",
        data_send = {
            pageNum: 1,
            pageSize: 12,
            orderByField: "id",
            userId: 2,
            ascend: true
        },
        method = "POST",
        nodeName1 = "dynamic-share",
        nodeName2 = "right-inner",
        lengthToScroll = 378;
    let shareArray = new shareArr();
    shareArray.setPlayNode([document.querySelectorAll(".cont")[0],document.querySelectorAll(".cont")[1]]);
    setFontSize(shareArray.getPlayNode());
    MainToPage.setBase(data_send, url, method, "Json");
    MainToPage.setNodeListToShow(shareArray, adjustPersonInfo);
    MainToPage.setFirstRequest(false);
    MainToPage.setWindowResize(nodeName1);
    MainToPage.setRollWithWindow(nodeName2, nodeName1, lengthToScroll, false);
};
initRun();
